package Tets;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Demo {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		String path = "C:/Users/weiyi/Desktop/项目1/data/day";
		//文件查找
		
		String filename = in.next();  
		String filePath=Utils.FindFile(path, filename);
		if(filePath.isEmpty()){
			throw new RuntimeException("无法找到文件");
		}
		//1)读数据
		File file =new File(filePath);
		InputStream is = new FileInputStream(file);		
		//2)处理数据
		List<Model> list =  Utils.getlist(is);
		//3)写数据
		File writefile =new File(path+"/"+filename+".csv");
		FileWriter fr=new FileWriter(writefile);
		BufferedWriter bw = new BufferedWriter(fr);
		for (Model s : list) {
			bw.write(s.toString());
			bw.newLine();
		}
	
	}


}
